package com.asset.pojo;

import java.util.Date;

public class User {


	private long id;
	private String name;
	private String loginName;//登录账号
	private String password;//登录密码
	private Short role;
	private Date addedTime;
	private Date modifyTime; //修改时间
    private Short status;   
	private String code;  //用户编号
	private String department;
	private Integer branchOffice;
	private String remark;  //备注
	
	private BranchOffice office; //分公司

	public enum Status{
		Normal("正常",(short)0),Disabled("禁用",(short)1),Deleted("已删除",(short)2),Inner("内部用户",(short)-1);
		private short value;
		private String zhName;
		Status(String zhName,short value){
			this.zhName=zhName;
			this.value= value;
		}
		// 通过 value ，枚举变量名|枚举变量的含义|查询枚举变量 三者选一即可
		public static Status getEnum(Short value,String enumName,String name){
			for(Status s : Status.values()){
				if(value != null && s.value==value){
					return s;
				}
				if(s.name().equals(enumName)){
					return s;
				}
				if(s.zhName.equals(name)){
					return s;
				}
			}
			return null;
		}
		public short getValue() {
			return value;
		}
		public String getZhName() {
			return zhName;
		}
	}
	public  enum Role{
		Admin("管理员",(short)0),User("普通用户",(short)1);
		private short value;
		private String zhName;
		Role(String zhName,short value){
			this.zhName = zhName;
			this.value= value;
		}
		// 通过 value ，枚举变量名，枚举变量的含义 查询枚举变量 三者选一即可
		public static Role getEnum(Short value,String enumName,String name){
			for(Role role : Role.values()){
				if(value != null && role.value==value){
					return role;
				}
				if(role.name().equals(enumName)){
					return role;
				}
				if(role.zhName.equals(name)){
					return role;
				}
			}
			return null;
		}
		public short getValue() {
			return value;
		}
		public String getZhName() {
			return zhName;
		}
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Short getRole() {
		return role;
	}

	public void setRole(Short role) {
		this.role = role;
	}

	public Date getAddedTime() {
		return addedTime;
	}

	public void setAddedTime(Date addedTime) {
		this.addedTime = addedTime;
	}

	public Date getModifyTime() {
		return modifyTime;
	}

	public void setModifyTime(Date modifyTime) {
		this.modifyTime = modifyTime;
	}

    public Short getStatus() {
        return status;
    }

    public void setStatus(Short status) {
        this.status = status;
    }
    
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public Integer getBranchOffice() {
		return branchOffice;
	}

	public void setBranchOffice(Integer branchOffice) {
		this.branchOffice = branchOffice;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public BranchOffice getOffice() {
		return office;
	}

	public void setOffice(BranchOffice office) {
		this.office = office;
	}

	@Override
	public String toString() {
		return "User [id=" + id + ", name=" + name + ", password=" + password + ", role=" + role + ", addedTime="
				+ addedTime + ", modifyTime=" + modifyTime + ", status=" + status + ", code=" + code + ", department="
				+ department + ", branchOffice=" + branchOffice + ", remark=" + remark + ", office=" + office + "]";
	}
}
